package apiday06home;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
/*
 块读写的文件复制
 */
public class CopyHome2 {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("cat2.jpg");
        FileInputStream fis = new FileInputStream("cat.jpg");
        byte[] data = new byte[1024 * 10];
        long start = System.currentTimeMillis();
        while((fis.read(data))!=-1){
            fos.write(data);
        }
        long end = System.currentTimeMillis();
        System.out.println("复制完毕，耗时"+(end-start)+"ms");
        fis.close();
        fos.close();
    }
}
